package com.zqh.irmadscore.model.enums;


import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum TractAlertType {
    // Typical nuclide monitor for fuel element breakage
    TYPICAL_NUCLIDE_MONITOR_FOR_FUEL_ELEMENT_BREAKAGE("燃料元件破损典型核素监测仪",
            20, 30),
    DELAYED_NEUTRON_MONITOR("缓发中子监测仪", 60, 70),
    TOTAL_GAMMA_AND_N16_RADIATION_MONITOR_1("总γ放射性及N-16衰变γ放射性监测仪",
            80, 95),
    TOTAL_GAMMA_AND_N16_RADIATION_MONITOR_2("总γ放射性及N-16衰变γ放射性监测仪1",
            80, 95),
    WASTEWATER_MONITORING_SYSTEM_MONITOR("排污水监测系统监测仪", 65, 70),
    WASTEWATER_MONITORING_SYSTEM_MONITOR_1("排污水监测系统监测仪1", 65, 70),
    CONDENSER_EXHAUST_RADIOACTIVITY_MONITOR("冷凝器抽气放射性监测仪", 80, 100),
    CONDENSER_EXHAUST_RADIOACTIVITY_MONITOR_1("冷凝器抽气放射性监测仪1", 80, 100),
    EQUIPMENT_COOLANT_LEAK_DETECTION_MONITOR("设备冷却水泄漏监测监测仪", 30, 50),
    RESIDUAL_HEAT_REMOVAL_SYSTEM_LEAKAGE_MONITOR("余热排出系统泄露监测仪", 65, 80),
    CIRCUIT_PIG_MONITOR("一回路堆仓PIG监测仪", 30, 50),
    N13F18_RADIATION_MONITOR("堆仓N-13/F-18放射性监测仪", 50, 80),
    GASEOUS_EFFLUENT_PIG_MONITOR("气态流出物PIG监测仪", 60, 120),
    GASEOUS_EFFLUENT_PIG_MONITOR_1("气态流出物PIG监测仪1", 60, 120),
    LIQUID_EFFLUENT_PIG_MONITOR("液态流出物PIG监测仪", 100, 110),
    LIQUID_EFFLUENT_PIG_MONITOR_1("液态流出物PIG监测仪1", 100, 110),
    CONTAINMENT_AIRBORNE_PIG_MONITOR("仓室气载扫描PIG监测仪", 80, 100),
    CONTAINMENT_AIRBORNE_PIG_MONITOR_1("仓室气载扫描PIG监测仪1", 80, 100),
    CONTAINMENT_AIRBORNE_PIG_MONITOR_2("仓室气载扫描PIG监测仪2", 80, 100);

    private final String tractName;
    private final double rank1Value;
    private final double rank2Value;


    // 根据传入的字符串值查找对应的枚举常量
    public static TractAlertType getEnumByValue(String value) {

        // 1.空值防御：如果输入值为空或空字符串，直接返回null
        if (ObjectUtil.isEmpty(value))  return null;

        // 2.遍历枚举：遍历该枚举类型的所有实例
        for (var anEnum : TractAlertType.values()) {
            // 3.值匹配：检查当前枚举实例的值是否与输入值匹配
            if (anEnum.getTractName().equals(value))  return anEnum;
        }
        // 4.未找到匹配项：遍历完所有枚举常量仍未找到时返回null
        return null;
    }

}

